package Container

import "errors"

//=====================stack=====================
type Stack struct {
	Data []int
	Count int
}

func (s *Stack)GetCount() int {
	return s.Count
}

func (s *Stack)IsEmpty() bool {
	return s.Count == 0
}

func (s *Stack)Push(d int) {
	s.Data = append(s.Data, d)
	s.Count++
}

func (s *Stack)Pop() int {
	if s.Count > 0 {
		s.Count--
		return s.Data[s.Count]
	} else {
		panic(errors.New("stack is empty"))
	}
}

//=====================queue=====================
type Queue struct {
	Data []int
	Count int
}